The follow table describes the type of Graphs displayed on this page
| Package Name | Graph Type |
|---|---|
| Matplotlib | violinplot |
| Seaborn | Scatterplot with continuous hues and sizes |
| Plotly | Scatter plots with Plotly Express |
Matplotlib(A violinplot) Click here to view this plot on the Matplotlib website
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')
# make data:
np.random.seed(10)
D = np.random.normal((3, 5, 4), (0.75, 1.00, 0.75), (200, 3))
# plot:
fig, ax = plt.subplots()
vp = ax.violinplot(D, [2, 4, 6], widths=2,
showmeans=False, showmedians=False, showextrema=False)
# styling:
for body in vp['bodies']:
body.set_alpha(0.9)
ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
ylim=(0, 8), yticks=np.arange(1, 8))
plt.show()
Seaborn(Scatterplot with continuous hues and sizes) Click here to view this plot on the Seaborn website
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the example planets dataset
planets = sns.load_dataset("planets")
cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True)
g = sns.relplot(
data=planets,
x="distance", y="orbital_period",
hue="year", size="mass",
palette=cmap, sizes=(10, 200),
)
g.set(xscale="log", yscale="log")
g.ax.xaxis.grid(True, "minor", linewidth=.25)
g.ax.yaxis.grid(True, "minor", linewidth=.25)
g.despine(left=True, bottom=True)
<seaborn.axisgrid.FacetGrid at 0x7fadb5b8e230>
Plotly (Scatter plots with Plotly Express) Click here to view this plot on the Plotly website
import plotly.express as px
import plotly.graph_objects as go
from sklearn.linear_model import LinearRegression
plotly.offline.init_notebook_mode()
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
fig.show()
This page was built by Norbert Osi Athekame
